<?php

/**
 * 运营在后台关联的商品，没有uid，需要记录note 主的uid
 * @auth tangyiwan
 */


ini_set('display_errors', 1);
error_reporting(-1);
ini_set('memory_limit', '512M');
require_once '/data/wwwroot/g_vendor/autoload.php';

use Biz\model\wiki\ObjRelateWiki as mObjRelateWiki;

$page = 1;
$pageSize = 200;
$list = [];
do {
    $limit = [($page - 1) * $pageSize, $pageSize];
    $list = mObjRelateWiki::getByWhere(['type' => 3, 'obj_type' => 1, 'LIMIT' => $limit], '*');
    var_dump(mObjRelateWiki::log());
    foreach ($list as $row) {
        $objId = $row['obj_id'];
        $uid = \Doraemon\tools\IdParse::getPhotoUid($objId);
        mObjRelateWiki::updateData(['uid' => $uid], ['id' => $row['id']]);
    }
    $page++;
} while ($list);